import request from '../utils/request';

/**
 * 更新地址
 * addr_id
 */
export function updateAddress(data) {
  return request({
    url: 'order/update-addr',
    method: 'post',
    data: data
  });
}

/**
 * 用户确认下单
 * remark
 */
export function orderConfirm(data) {
  return request({
    url: 'order/confirm',
    method: 'post',
    data: data
  });
}

/**
 * 用户支付订单
 * order_id pay_type 1 wx 2 zfb pay_platform 1 xcx 2 h5
 */
export function orderPay(data) {
  return request({
    url: 'order/pay',
    method: 'post',
    data: data
  });
}

/**
 * 测试支付
 * order_id pay_type 1 wx 2 zfb pay_platform 1 xcx 2 h5
 */
export function testPay(data) {
  return request({
    url: 'order/paid',
    method: 'post',
    data: data
  });
}
/**
 * 获取运费
 * order_id pay_type 1 wx 2 zfb pay_platform 1 xcx 2 h5
 */
 export function getfree(data) {
  return request({
    url: 'express/shipping',
    method: 'post',
    data: data
  });
}
/**
 * 获取用户的临时订单
 */
export function tempOrder(data) {
  return request({
    url: 'order/temp-order',
    method: 'get',
    data: data
  });
}

/**
 * 订单列表
 * 订单状态;-1 全部;0 未支付;1 已取消;2 已付款;3 已发货;4 已收货;5 已完成;6 已评价; 7 已退款
 * order_status, page, page_number
 */
export function getOrderList(data) {
  return request({
    url: 'order/lists',
    method: 'get',
    data: data
  });
}

/**
 * 订单详情
 * order_info_id
 */
export function orderDetail(data) {
  return request({
    url: 'order/detail',
    method: 'get',
    data: data
  });
}

/**
 * 发票创建
 * order_id type company_name company_tax identify_num mobile address
 */
export function invoiceCreate(data) {
  return request({
    url: 'receipt/create',
    method: 'post',
    data: data
  });
}
//批量发票创建
export function batchInvoiceCreate(data) {
  return request({
    url: '/receipt/batch-create',
    method: 'post',
    data: data
  });
}

/**
 * 退款理由
 */
export function cancleList() {
  return request({
    url: 'cancel/lists',
    method: 'get'
  });
}

/**
 * 订单删除
 * order_info_id
 */
export function deleteOrder(data) {
  return request({
    url: 'order/delete',
    method: 'post',
    data: data
  });
}

/**
 * 订单取消
 * order_info_id cancel_id
 */
export function calOrder(data) {
  return request({
    url: 'order/cancel',
    method: 'post',
    data: data
  });
}

/**
 * 订单收货
 * order_info_id
 */
export function deliveryOrder(data) {
  return request({
    url: 'order/delivery',
    method: 'post',
    data: data
  });
}

/**
 * 订单完成
 * order_info_id
 */
export function orderCheck(data) {
  return request({
    url: 'order/check',
    method: 'post',
    data: data
  });
}

/**
 * 物流查询
 * order_id
 */
export function checkExpress(data) {
  return request({
    url: 'express/route',
    method: 'post',
    data: data
  });
}

/**
 * 修改订单的提货时间
 * order_id
 * delivery_time
 */
export function updateOrderTime(data) {
  return request({
    url: 'order/update/delivery-time',
    method: 'post',
    data: data
  });
}

/**
 * 修改订单的提货时间
 * order_id
 * addr_id
 */
export function updateOrderAddress(data) {
  return request({
    url: 'order/update/address',
    method: 'post',
    data: data
  });
}